package com.example.demo.readController;

import com.example.demo.readDao.ReadDao;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.xssf.usermodel.XSSFSheet;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.io.IOException;
import java.util.ArrayList;

@RestController
public class ReadTest {
    @Autowired
    private  ReadDao readDao;


  static   ArrayList list = new ArrayList<>();

   // public static void main(String[] args) throws IOException {

        // List list = new List<>();
    @GetMapping("1")
    public void a() throws IOException {
        //获取工作薄

        XSSFWorkbook workbook = new XSSFWorkbook("D:\\莱西有利数据\\莱西有礼数据导出\\储值卡账户信息.xls");

        try {
            //获取工作表
            XSSFSheet sheetAt = workbook.getSheetAt(0);
            int i=0;
            //获取行
            for (Row cells : sheetAt) {
                if(i==0){
                    i++;
                    continue;
                }
                Cell cell = cells.getCell(8);
                System.out.println(cell);

                String stringCellValue = cell.getStringCellValue();
                System.out.println(stringCellValue);
                list.add(stringCellValue);
            }


            workbook.close();

        }catch (Exception e){

        }finally {
            workbook.close();

        }



    //   readDao.insert(list);


    }




}
